
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'Brush: Object' { ... };

----------------------------------------------------------------------------------
-- func: Brush.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function Brush.__init__( self )
    Object.__init__( self );
end

----------------------------------------------------------------------------------
-- func: Brush:Create
-- desc: Not implemented. Error on call.
----------------------------------------------------------------------------------
function Brush:Create( parent )
    slimui:err( 'not implemented' );
end

----------------------------------------------------------------------------------
-- func: Brush:Bind
-- desc: Binds this brush object to the given brush.
----------------------------------------------------------------------------------
function Brush:Bind( brush )
    if brush == nil then
        slimui:err( 'Brush:Bind - parent brush cannot be nil' );
    end
    
    local class = object_getClassName( brush );
    if string.lower( class ) ~= 'tbrush' then
        slimui:err( 'Brush:Bind - cannot bind to objects that are not a brush!' );
    end
    
    self._object = brush;
    
    return self;
end

----------------------------------------------------------------------------------
-- func: Brush:GetColor
-- desc: Returns the color of this brush.
----------------------------------------------------------------------------------
function Brush:GetColor( )
    return brush_getColor( self._object );
end

----------------------------------------------------------------------------------
-- func: Brush:SetColor
-- desc: Sets the color of this brush.
----------------------------------------------------------------------------------
function Brush:SetColor( color )
    brush_setColor( self._object, color );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) brush.lua successfully loaded.' );
end